﻿using strange.extensions.context.api;
using strange.extensions.context.impl;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameContext : MVCSContext {//所有绑定发生的环境

    public GameContext(MonoBehaviour view, bool autoMapping) : base(view, autoMapping)
	{

    }
    /// <summary>
    /// 实现各种绑定
    /// </summary>
    protected override void mapBindings()
    {
      
        Debug.Log("实现各种绑定");
        //三种绑定方法
        //injectionBinder 注入 接口
        injectionBinder.Bind<ISomeService>().To<ScoreService>().ToSingleton();
        injectionBinder.Bind<ISomeModel>().To<ScoreModel>().ToSingleton();
        //commandBinder 根据事件绑定起作用的命令
        commandBinder.Bind(Events.REQUEST_WEB_SCORE).To<RequestCommand>();
        commandBinder.Bind(Events.ADD_SCORE).To<AddScoreCommand>();
        //mediationBinder
        mediationBinder.Bind<BallView>().To<BallMediator>();
        //StartCommand fires when START fires, then unmaps itself 绑定 后运行就取消绑定
        commandBinder.Bind(ContextEvent.START).To<FirstCommand>().Once();

    }
}
